home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / INT86.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  1.5 KB  |  68 lines

  1. /* INT86.C --- p. 625 */
  2. #ifdef EXAMPLE_1
  3. #include <dos.h>
  4. #define BIOS_VIDEO 0x10
  5. void putcursor(int row, int col)
  6. {
  7.     union REGS xr;
  8.     xr.h.ah = 2;            /* Function number to set cursor */
  9.     xr.h.dh = row;
  10.     xr.h.dl = col;
  11.     xr.h.bh = 0;            /* Assume video page 0    */
  12.                     /* Use xr for both input/output    */
  13.     int86(BIOS_VIDEO, &xr, &xr);
  14. }
  15. #endif
  16. #ifdef EXAMPLE_2
  17. #include <stdio.h>
  18. #include <dos.h>
  19. #define BIOS_PRNTSCR 5
  20. union REGS xr;
  21. main()
  22. {
  23.     printf("test: Printing screen\n");
  24.     int86(BIOS__PRNTSCR, &xr, &xr);
  25. }
  26. #endif
  27. #ifdef EXAMPLE_3
  28. #include <stdio.h>
  29. #include <dos.h>
  30. #define DOS_GETDATE 0x2a
  31. #define DOS_INT 0x21
  32. static char *months[] = { "---", "JAN", "FEB", "MAR", "APR",
  33.         "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
  34. main()
  35. {
  36.     union REGS xr, yr;
  37.     xr.h.ah = DOS_GETDATE;
  38.     int86 (DOS_INT, &xr, &yr);
  39.     printf("Today's date is: %.2d-%s-%.4d\n",
  40.                 yr.h.dl, months[yr.h.dh], yr.x.cx);
  41. }
  42. #endif
  43. #include <stdio.h>
  44. #include <dos.h>
  45. static union REGS xr, yr;
  46. #define BIOS_VIDEO 0x10
  47. main()
  48. {
  49.         /* Set up registers as needed by BIOS video function. */
  50.     xr.h.ah = 0x12;
  51.     xr.h.bl = 0x10;
  52.     int86 (BIOS_VIDEO, &xr, &yr);
  53.                 /* Upon return values are in structure yr */
  54.     if (yr.h.bh == 0) printf("EGA in color mode\n");
  55.     if (yr.h.bh == 1) printf("EGA in mono mode\n");
  56.     printf("Memory size: ");
  57.     switch (yr.h.bl)
  58.     {
  59.         case 0: printf("64K\n");
  60.             break;
  61.         case 1: printf("128K\n");
  62.             break;
  63.         case 2: printf("192K\n");
  64.             break;
  65.         case 3: printf("256K\n");
  66.             break;
  67.     }
  68. }